package LeetCode刷题;

/**
 * @program: Java_Study
 * @author: Xiaofan
 * @createTime: 2021-11-13 10:46
 * @description: Functions of this class is
 **/
public class 二叉树的由下往上层序遍历 {
    public static void main(String args[]){

    }
    /**
     * class Solution {
     *     public List<List<Integer>> levelOrderBottom(TreeNode root) {
     *         List<List<Integer>> ans=new ArrayList<List<Integer>>();
     *         if(root!=null){
     *             LinkedList<TreeNode> queue=new LinkedList<TreeNode>();
     *             LinkedList<List<Integer>> reverseStack=new LinkedList<List<Integer>>();
     *             queue.add(root);
     *             while(!queue.isEmpty()){
     *                 int size=queue.size();
     *                 List<Integer> sub=new ArrayList<Integer>();
     *                 while(size-->0){
     *                     TreeNode p=queue.poll();
     *                     sub.add(p.val);
     *                     if(p.left!=null){
     *                         queue.add(p.left);
     *                     }
     *                     if(p.right!=null){
     *                         queue.add(p.right);
     *                     }
     *                 }
     *                 reverseStack.push(sub);
     *             }
     *             for(List<Integer> list:reverseStack){
     *                 ans.add(list);
     *             }
     *         }
     *         return ans;
     *     }
     * }
     */
}